"""author: wenyao
   data: 2021/4/19
   project: devopscmdb
"""

#atm系统
#登陆
  #取钱
  #存钱
  #查询
  #退出

user  = {"root":{"passwd":"123456","money":2000},"admin":{"passwd":"admin","money":1000}}

def login(username, passwd):
    if username in user and user.get(username).get("passwd") == passwd:
        print("登陆成功".center(50,"*"))
        return 1
    else:
        print("登陆失败".center(50,"*"))
        return 0

def menu():
    print("1.取钱".center(20," "))
    print("2.存钱".center(20, " "))
    print("3.查询".center(20, " "))
    print("4.退出".center(20, " "))
    num = input("请输入你的选择:")
    return num

def get_money(username,money):
    m1 = user.get(username).get("money")
    if m1 >= money:
        user[username]["money"] = m1 - money
        print("取钱成功")
    else:
        print("余额不足！！！！！！！！！，无法进行交易!")

print("欢迎来到三创atm".center(50,"*"))
username = input("请输入用户名:")
passwd = input("请输入密码:")

login_status = login(username, passwd)
if login_status == 1:
    while 1:
        choice = menu()
        if choice == "1":
            money = input("请输入要取款的金额:")
            get_money(username,int(money))
        elif choice == "2":
            pass
        elif choice == "3":
            pass
        else:
            pass

print(max())





